package com.threaddemo8;

import java.util.concurrent.locks.LockSupport;

public class LockSupportDemo {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("进入线程了。。。");
                System.out.println("线程暂停，调用了park");
                //LockSupport.park();
                try {
                    LockSupportDemo.class.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("线程继续执行了。。。");
            }
        });

        t.start();
        t.interrupt();
        Thread.sleep(3000);
        System.out.println("主线程执行。。。。");
        LockSupportDemo.class.notify();
        //LockSupport.unpark(t);
    }
}
